package hongcaosp.app.android;

import android.app.Application;

import com.tencent.rtmp.TXLiveBase;

import hongcaosp.app.android.login.RegisterActivity;
import hongcaosp.app.android.login.UserToken;
import hongcaosp.app.android.modle.DataCallBack;
import hongcaosp.app.android.modle.ErrorHandler;
import xlj.lib.android.base.component.ActivityStack;
import xlj.lib.android.base.toastcompat.ToastManager;

public class HongCaoApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        TXLiveBase.getInstance().setLicence(this,BuildConfig.TXUGC_LICENSE_URL,BuildConfig.TXUGC_LICENSE_KEY);
        ToastManager.getInstance().init(this);

        UserToken.getDefault().setContext(this);

        /**
         *
         */
        DataCallBack.addErorrHandler(-2, new ErrorHandler() {
            @Override
            public void onHandle() {
                UserToken.getDefault().clearToken();
                RegisterActivity.toRegister(ActivityStack.topActivity());
            }
        });
    }
}
